Currently, there is no external level editor for JSokoban. I may write one in the future, but now your only option for creating external level files is ResEdit.
How to get ResEdit
ResEdit is available from User Groups, national bulletin board services like America Online, and the Internet. If you don’t have access to any of these, check where you got JSokoban. There are several good books out on ResEdit that include a free copy. Check your local bookstore.
Setting up ResEdit
ResEdit is a powerful (free) tool from Apple, that lets you edit the individual pieces of data, or resources, that make up every Mac program and many other types of files. But this power comes with a price… you can seriously damage files you edit. So always, always, always work on a backup. That standard disclaimer out of the way, I’ll describe the process of editing.
ResEdit is modular, meaning you can add new editors for new resources without getting a brand new version of ResEdit. When you start up ResEdit the first time, it creates a preferences file in the System Folder. This preferences file is the ideal place for adding in your customizations to ResEdit. Open the “Put in ResEdit Preferences” file. Whenever you first open a file in ResEdit, you see a list of all the resource types (four letter codes) in that file. Select both the ‘ICON’ and ‘RMAP’ types and copy them (command-C or Copy under the Edit menu). Then open the “ResEdit Preferences” file in the Preferences folder of your System Folder. (It will be in the System Folder if you’re using System 6.) Paste the resources in, then close both files, clicking the “Yes” button when asked if you want to save.
The final step is to drag the JSokoban Font suitcase onto your System Folder icon. (In System 6, use the Font/DA Mover to copy the font into your System file.)
Editing the levels
The first step in creating a new level file is to duplicate the “Level file template” in the Finder. Then open ResEdit and use the open command to work on the freshly made copy.
To add new levels to the file, open the LEVL resources and then choose the “Create new resource” menu command from the resource menu. A blank level will appear, ready to be filled in. Always make sure your LEVL IDs start at 128 and go up in order of increasing level. JSokoban identifies level number through resource ID number.
The levels are just text, with the following characters representing various items in the game:
space: empty
. destination
# wall
@ man
+ man on destination
$ money bag
* money bag on destination
You can edit them inside ResEdit, or copy the contents out to your favorite text editor and work on them there. ResEdit works fine with monospaced fonts like Courier and Monaco, but if you want to use the JSokoban font to view a medium to large level, you’ll have to use a text editor.
You can end a line of the level after you finish the last wall; the empty spaces will be filled in for you. Remember to always make a wall all the way around the level, so the man can’t go play in la-la land. And put only one man in each level. Actually, JSokoban does not crash on weird levels, it just behaves strangely. On levels with no wall, the man can go off the screen. On levels with more than one man, only the last man is used. Also, include at least as many bags as destination squares.
Also, be sure to change the ’vers’ 1 and 2 resources to indicate the name of your levels and your name, copyright, etc.
The hardest resource to create is the DEMO resource. Every external level file has one, with ID 1000. It contains the keystrokes (from numeric keypad) necessary to solve the first level of the external file. Carriage returns signal pauses. The built in JSokoban demo, and the Extra demo both use a pause after positioning each bag. If you don’t want to spend the time to create this resource, delete it from your external file and JSokoban will dim the Demo menu command.
The RECT and LEV# resources are used internally by JSokoban to save the current level number and location of the window onscreen. Do not modify these resources. JSokoban will set them the first time you use the external level file, so there’s no need to worry about them.